using UnityEngine;

namespace RGuang.PlathformCtrl
{
    public class PlayerGroundDetector : MonoBehaviour
    {
        [SerializeField] float detectorRaduis = 0.1f;
        [SerializeField] LayerMask groundLayer;

        Collider[] results = new Collider[1];

        public bool IsGrounded => Physics.OverlapSphereNonAlloc(transform.position, detectorRaduis, results, groundLayer) != 0;

        private void OnDrawGizmosSelected()
        {
            Gizmos.color = Color.cyan;
            Gizmos.DrawWireSphere(transform.position, detectorRaduis);
        }

    }

}
